package main

import (
	"fmt"
	"net"
	"os"
)

func main()  {
	con, err := net.Dial("tcp","127.0.0.1:8888")
	if err !=nil {
		return
	}
	// e是指数
	num := 2e12 // float
	fmt.Printf("%f\n",num)
	con.Write([]byte("我想购买去上海的机票"))
	p:=make([]byte,1024)
	//time.Sleep(time.Second)
	a :=23
	_ =a
	n,err:=con.Read(p)
	if err !=nil{
		fmt.Println(err)
		return
	}
	fmt.Println(n)
	fmt.Println(string(p))
}
func readFile() []byte  {
	name :="/Users/yongli/logs/msv.log"
	file,err := os.Open(name)
	if err !=nil{
		return nil
	}
	p :=make([]byte,1024)
	res := make([]byte,1024)
	for {
		n,_ :=file.Read(p)
		if n<=0{
			break
		}
		//copy(res,p) res复制时没有多余空间了
		// unpack silce
		res = append(res,p...)
	}
	return res

}
